package cn.com.dao;

import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;

import cn.com.entity.Manager;

public class ManagerDao {
	//管理员dao文件
	private SessionFactory sessionFac;
	public SessionFactory getSessionFac() {
		return sessionFac;
	}
	public void setSessionFac(SessionFactory sessionFac) {
		this.sessionFac = sessionFac;
	}
	Session session;
	//管理员登录功能
	public boolean managerLogin(Manager manager){
		boolean bool=false;
		session=sessionFac.openSession();
		Query query=session.createQuery("from Manager where managername=? and managerpwd=?");
		query.setString(0,manager.getManagername());
		query.setString(1, manager.getManagerpwd());
		List<Manager> list=query.list();
		if(list.size()==1){
			bool=true;
		}
		session.close();
		return bool;
	}
}
